/**
 * Copyright 2013 Viettel Telecom. All rights reserved.
 * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.viettel.core.entities.cms;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.Index;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;

import com.viettel.core.enumtype.AnswersQuestionStatus;

/**
 *  TABLE TRA LOI CAU HOI
 *  @author: ToanTM1
 *  @version: 2.1
 *  @since: 27-02-2014 - 17:57:53
 */
@Entity
@Table(name = "ANSWERS_QUESTION")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@SequenceGenerator(name = "SEQ_STORE", sequenceName = "ANSWERS_QUESTION_SEQ", allocationSize = 1)
public class AnswersQuestion implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 7895875126931382174L;

	/**
	 * ID
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_STORE")
	@Column(name = "ID")
//	@Index(name="ANSWERS_QUESTION_ID_PK")
	private Integer id;
	
	/**
	 * NOI DUNG TRA LOI
	 */
	@Basic
	@Column(name = "CONTENT", length = 4000)
	private String content;
	
	/**
	 * GHI CHU
	 */
	@Basic
	@Column(name = "NOTE", length = 500)
	private String note;
	
	/**
	 * DANH GIA CAU TRA LOI
	 */
	@Basic
	@Column(name = "RATE", columnDefinition = "NUMBER(1,0)")
	private Integer rate;
	
	/**
	 * ID FAQ
	 */
	@ManyToOne(targetEntity = FAQs.class)
	@JoinColumn(name = "FAQs_ID", referencedColumnName = "id")
	@ForeignKey(name = "ANSWERS_FAQs_FK")
	private FAQs fAQs;
	
	/**
	 * CHUYEN GIA TRA LOI
	 */
	@ManyToOne(targetEntity = CmsUser.class)
	@JoinColumn(name = "CMS_USER_ID", referencedColumnName = "id")
	@ForeignKey(name = "ANSWERS_CMS_USER_FK")
	private CmsUser cmsUser;
	
	/**
	 * NONG DAN TRA LOI
	 */
	@ManyToOne(targetEntity = Users.class)
	@JoinColumn(name = "USER_ID", referencedColumnName = "id")
	@ForeignKey(name = "ANSWERS_QUESTION_USER_FK")
	private Users users;
	
	/**
	 * TRANG THAI CAU TRA LOI
	 */
	@Basic
	@Column(name = "STATUS", columnDefinition = "NUMBER(1,0)", nullable = false)
	@Type(type = "com.viettel.core.enumtype.GenericEnumUserType", parameters = {
			@Parameter(name = "enumClass", value = "com.viettel.core.enumtype.AnswersQuestionStatus"),
			@Parameter(name = "identifierMethod", value = "getValue"),
			@Parameter(name = "valueOfMethod", value = "parseValue") })
	@Index(name="ANSWERS_QUESTION_STATUSX")
	private AnswersQuestionStatus status;
	
	/**
	 * THOI GIAN TAO
	 */
	@Basic
	@Column(name = "CREATED_TIME", columnDefinition = "timestamp(9) default systimestamp", insertable = false, updatable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date createdTime;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public Integer getRate() {
		return rate;
	}

	public void setRate(Integer rate) {
		this.rate = rate;
	}

	public FAQs getfAQs() {
		return fAQs;
	}

	public void setfAQs(FAQs fAQs) {
		this.fAQs = fAQs;
	}

	public CmsUser getCmsUser() {
		return cmsUser;
	}

	public void setCmsUser(CmsUser cmsUser) {
		this.cmsUser = cmsUser;
	}

	public Users getUsers() {
		return users;
	}

	public void setUsers(Users users) {
		this.users = users;
	}

	public AnswersQuestionStatus getStatus() {
		return status;
	}

	public void setStatus(AnswersQuestionStatus status) {
		this.status = status;
	}

	public Date getCreatedTime() {
		return createdTime;
	}

	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}
}
